﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Messaging;

namespace msap.SystemManager.UserManager
{
    /// <summary>
    /// Index.xaml 的交互逻辑
    /// </summary>
    public partial class IndexForm : Page
    {
        public IndexForm()
        {
            InitializeComponent();
            Messenger.Default.Register<ViewModelBase>(this, "UserManager_ShowInsertForm", true, ShowUserInsertForm);
            Messenger.Default.Register<ViewModelBase>(this, "UserManager_ShowRoleManagerForm", true, ShowUserRoleManageForm);
        }

        private void ShowUserInsertForm(ViewModelBase vm)
        {
            InsertForm form = new InsertForm();
            form.DataContext = vm;
            form.ShowDialog();
        }

        private void ShowUserRoleManageForm(ViewModelBase vm)
        {
            UserRoleManagerForm form = new UserRoleManagerForm();
            form.DataContext = vm;
            form.ShowDialog();
        }

    }
}
